package com.kadron.action;

import com.kadron.datamodel.KModel;
import com.kadron.entity.Discount;

public class KDiscountModel implements KModel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8075598194638609783L;
	
	private Discount discount;
	
	private KDiscountModel() {
		super();
	}
	
	public KDiscountModel(Discount discount) {
		this();
		this.discount = discount;
	}

	@Override
	public long getId() {
		return discount.getId();
	}

	public Discount getDiscount() {
		return discount;
	}

	public void setDiscount(Discount discount) {
		this.discount = discount;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (discount.getId() ^ (discount.getId() >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		KDiscountModel other = (KDiscountModel) obj;
		if (discount.getId() != other.discount.getId())
			return false;
		return true;
	}
	
}
